-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CosmosClientOptions: Adds validation for ApplicationName #3455
CosmosClientOptions: Adds validation for ApplicationName #3455
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors|Removes) Description"
Internal should be used for PRs that have no customer impact. This flag is used to help generate the changelog to know which PRs should be included. Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs
Outdated
Show resolved
Hide resolved
…contain illegal or dangerous characters
I also want to note that like @ealsur mentioned in the issue the actual validation is not being done by the SDK therefore we cannot use the |
@NaluTripician The source of the problem is the HttpHeader failure, why did we revert that in place of the individual character validation? What is the benefit? Are there any characters that could still make the HttpHeader fail? |
The previous function I was using was using in the HttpHeader class was not working however I have found the correct one and updated the code to use that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Substring(20) seems artificial on initial glance - needs some explanation or changes to the code to make it easier to understand.
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs
Outdated
Show resolved
Hide resolved
....Tests/BaselineTest/TestBaseline/PassThroughQueryBaselineTests.NegativePassThroughOutput.xml
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just one small comment, please mark the PR ready for review
5951129
…ectly catch all valid/invalid names
Bot not reacting correctly
Co-authored-by: Matias Quaranta <ealsur@users.noreply.github.com>
Pull Request Template
Description
User found that when
ApplicationName
contains an invalid value, the SDK is basically blocked (all requests fail). In order to prevent this, validation was added when setting application name that checks to see if it contains any illegal characters or values using theHttpHeaders.NameValueHeaderValue.Parse
function. If found the SDK will throw anArgumentException
letting the user know that theirApplicationName
contains illegal characters. Some of the aforementioned illegal characters can be found in the RFC1783 page 2 and 3. It should also be noted that although the "&" symbol there is said to be unsafe, through testing it appears to be a valid symbol to be used so the list of illegal characters for the SDK is slightly different than the ones mentioned in RFC1738, but the Parse function is able to tell which of these value are indeed unsafe.Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #3040